home *** CD-ROM | disk | FTP | other *** search
- Path: news.mcs.net!usenet
- From: Michael Spertus <mps@geodesic.com>
- Newsgroups: comp.lang.c++,comp.os.ms-windows.programmer.win32
- Subject: Re: VC++ 4.0 memory allocation slower than in 2.x!!!
- Date: Mon, 01 Apr 1996 16:00:33 -0800
- Organization: Geosdesic Systems
- Message-ID: <31606E21.51EB@geodesic.com>
- References: <alanDozpsy.Kn6@netcom.com> <315C4DA0.30C@Bentley.com> <316049E7.739D@sdt.com>
- NNTP-Posting-Host: jlh.pr.mcs.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- > - This sort of thing can't help but bias benchmarks, as evidenced
- > by last months' Byte Magazine on the subject. They discovered a
- > similar performance sensitivity to malloc: sometimes (at least, with
- > MS 4.x) it returns byte-aligned allocations, rather than word
- > aligned. This causes roughly a 50% (20%?) performance penalty on the
- > Pentium for misaligned 32-bit or greater reads, as the hardware has
- > to do some monkey business for things like floats, doubles, ints...
- > This is not quite accurate. Windows NT memory allocation always returns
- 32-bit aligned data. However, doubles are 64 bit aligned and the Pentium
- has a 64 bit data bus, so applications using doubles may be randomly up
- to 300%(!) slower as the BYTEmarks were. Non-aligned loads drop the Pentium
- into microcode with huge performance penalties.
-
- ** Warning: The following is an interesting anecdote about how this was
- ** discovered but also plugs our own product a bit.
- This limitation was unearthed in a serendipitous way.
- When we visited BYTE labs demonstrating Great Circle (a C++ garbage
- collector), they had me drop it into the BYTEmark even though no dynamic
- memory allocation was going on during the benchmark loop. We were
- flabbergasted to discover that we fixed the problem, even though no
- garbage collection took place. This was one step in discovering
- that the problem was alignment (because our allocator always properly
- aligns data) and also made us aware of a potentially important unexpected
- benefit to our product.
-